# Figures for: 
# Class, Policy Attitudes and U.S. Presidential Voting in the Post-Industrial Era: 
#  The Importance of Issue Salience
# Franko & Witko
# Political Research Quarterly
# Date: 05/25/22


# Install and load required packages.
if (!require(tidyverse)) install.packages("tidyverse")
library(tidyverse)
if (!require(haven)) install.packages("haven")
library(haven)
if (!require(janitor)) install.packages("janitor")
library(janitor)


### Change path to directory where replication files are stored. ###
setwd("~/Dropbox/Class/ClassPolicyAttitudesVotingPaper/prq-final-data")


##################################################
# Set theme options.
##################################################

color.background <- "#F0F0F0"
color.grid.major <- "#DBDBDB"
fte_theme <- function() {
	theme(plot.background = element_rect(fill = color.background)) + 
	theme(panel.background = element_rect(fill = color.background, 
		colour = color.background)) +
	theme(panel.grid.major=element_line(color = color.grid.major, size = .25)) +
	theme(panel.grid.minor = element_blank()) +
	theme(axis.ticks = element_blank()) +
	theme(axis.title.x = element_text(vjust = -0.5), 
		axis.title.y = element_text(vjust = 1.2)) +
  theme(plot.title = element_text(hjust = 0.5))
}
#theme2 <- theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())

##################################################
# Labels.
##################################################

class_labs <- c("edu5"="Edu. low -\nedu. high", 
                "egp1.5"="Working\nclass -\nupper class", 
                "egp2.5"="Working\nclass -\nupper middle", 
                "inc5"="Inc. low -\ninc. high", 
                "subclass"=
                  "Subjective\nlower class -\nupper class", 
                "white"="Nonwhite -\nwhite")

class_labs2 <- c("edu5"="Edu. low -\nedu. high", 
                "egp1.5"="Working class -\nupper class", 
                "egp2.5"="Working class -\nupper middle", 
                "inc5"="Inc. low -\ninc. high", 
                "subclass"=
                  "Subj. low class -\nupper class", 
                "white"="Nonwhite -\nwhite")


##################################################
# Class and voting.
##################################################

# Low/high difference effects.

# Load data.
vdiffs1 <- read_dta("./results/dvote_diffs_gss.dta")
vdiffs2 <- read_dta("./results/dvote_diffs_anes.dta")

# Combine difference estimates for plotting.
# Create DV indicator.
vdiffs1$dv <- "Vote Dem. (GSS)"
vdiffs2$dv <- "Vote Dem. (ANES)"

# Combine results.
vdiffs.all <- bind_rows(vdiffs1, vdiffs2)
# Reorder factors.
vdiffs.all$sample <- factor(vdiffs.all$sample, 
                           levels = c("White", 
                                      "Nonwhite", 
                                      "All"))
vdiffs.all$var <- factor(vdiffs.all$var, 
                        levels = c("white", "edu5", 
                                   "inc5", "egp2.5", 
                                   "egp1.5", "subclass"))
vdiffs.all$dv <- factor(vdiffs.all$dv, 
                       levels = c("Vote Dem. (GSS)",
                                  "Vote Dem. (ANES)"))


# Plots.

figDiffsVote <- ggplot(vdiffs.all, aes(y = factor(var), 
                                       x = diff, 
                                       group = sample)) +
  geom_vline(xintercept = 0, color = "gray", 
             linetype = "dashed") +
  ggplot2::geom_errorbarh(aes(xmin = ll, xmax = ul), 
                          size = 1.0, color = "gray", 
                          height = 0, 
                          position=ggstance::position_dodgev(height=0.5)) +
  geom_point(aes(color = sample, shape = sample), size = 2, 
             position=ggstance::position_dodgev(height=0.5)) +
  facet_wrap( ~ dv, ncol = 2) +
  labs(x = "Change in Support", 
       y = "Social Class Characteristics") +
  fte_theme() +
  theme(legend.text = element_text(size = 10),
        legend.title = element_blank(),
        legend.key = element_rect(color = color.background), 
        legend.position = "bottom",
        strip.text.x = element_text(size = 8),
        legend.spacing.x = unit(0.5, 'cm')) +
  scale_y_discrete(labels = class_labs) +
  scale_shape_discrete(breaks = c("All", 
                                  "Nonwhite", "White")) +
  scale_color_discrete(breaks = c("All", 
                                  "Nonwhite", "White")) +
  theme(plot.background = element_rect(fill = "white"))


tiff(file = "fig1.tif", width=7.0, height=4.5, units="in", res=600)
figDiffsVote
dev.off()



##################################################
# Over time effects.
# Voting.
##################################################

# Load data.
# GSS.
vgss.egp <- read_dta("./results/dvote_egp1_gss_time.dta")
vgss.subclass <- read_dta("./results/dvote_subclass_gss_time.dta")
vgss.inc <- read_dta("./results/dvote_inc5_gss_time.dta")
vgss.edu <- read_dta("./results/dvote_edu5_gss_time.dta")

# ANES
vanes.egp <- read_dta("./results/dvote_egp1_anes_time.dta")
vanes.subclass <- read_dta("./results/dvote_subclass_anes_time.dta")
vanes.inc <- read_dta("./results/dvote_inc5_anes_time.dta")
vanes.edu <- read_dta("./results/dvote_edu5_anes_time.dta")

# Create DV indicator.
vgss.egp$dv <- "Vote Dem. (GSS)"
vanes.egp$dv <- "Vote Dem. (ANES)"

# Combine estimates for plotting.
# First need to rename and create variables.
vegplst <- list(vgss.egp, vanes.egp)
vegplst <- vegplst %>%
  map(~ rename(., b = b_egp)) %>%
  map(~ rename(., b_hi = b_egp_hi)) %>%
  map(~ rename(., b_lo = b_egp_lo)) %>%
  map(~ mutate(., var = ifelse(egp5 == 1, "Upper Class", 
                               "Upper Mid. Class")))

# Combine list of data frames.
time.vote <- bind_rows(vegplst)

# Create DV indicators and combine other data frames.
vglst <- list(vgss.subclass, vgss.inc, vgss.edu)
vglst <- vglst %>%
  map(~ mutate(., dv = "Vote Dem. (GSS)"))

valst <- list(vanes.subclass, vanes.inc, vanes.edu)
valst <- valst %>%
  map(~ mutate(., dv = "Vote Dem. (ANES)"))

time.vote <- bind_rows(time.vote, vglst, valst)

# Rename variables.
time.vote <- 
  time.vote %>% 
  mutate(var = recode_factor(var, 
                             "Upper Class" = "Upper Class",
                             "Upper Mid. Class" = "Upper Mid. Class",
                             "subclass" = "Subjective Class",
                             "inc5" = "Income",
                             "edu5" = "Education", 
                             .ordered = TRUE))

# Reorder DV.
vdv.ord <- c("Vote Dem. (GSS)",
             "Vote Dem. (ANES)")
time.vote$dv <- factor(time.vote$dv, 
                       levels = vdv.ord)


# Save combined data.
#write_dta(time.vote, "time_vcls.dta")
saveRDS(time.vote, "./results/time_vcls.rds")


# Plots.

figTimeVote <- ggplot(time.vote, aes(y = b, x = year)) +
  geom_hline(yintercept = 0, color = "gray", linetype = "dashed") +
  geom_errorbar(aes(ymin = b_lo, ymax = b_hi), 
                size = 1, color = "gray", width=0) +
  geom_point(color = "#00ba38", size = 2) +
  facet_grid(var ~ dv, scales = "free_y") +
  labs(x = "Year", 
       y = "Estimated Coefficients") +
  fte_theme() +
  theme(legend.position = "none") +
  scale_x_continuous(breaks = seq(1972, 2018, 8)) +
  theme(plot.background = element_rect(fill = "white"))

tiff(file = "fig2.tif", width=6, height=6, units="in", res=600)
figTimeVote
dev.off()


##################################################
# Class and policy.
##################################################

# Low/high difference effects.

# Load data.
e.diffs1 <- read_dta("./results/ineq_diffs.dta")
e.diffs2 <- read_dta("./results/jobs_diffs.dta")
c.diffs1 <- read_dta("./results/cultgss_diffs.dta")
c.diffs2 <- read_dta("./results/cultanes_diffs.dta")
r.diffs1 <- read_dta("./results/racegss_diffs.dta")
r.diffs2 <- read_dta("./results/raceanes_diffs.dta")

# White only for race estimates.
r.diffs1 <- filter(r.diffs1, sample=="White") 
r.diffs2 <- filter(r.diffs2, sample=="White") 

# Combine difference estimates for plotting.
# Create DV indicator.
e.diffs1$dv <- "Reduce inequality (GSS)"
e.diffs2$dv <- "Guarantee jobs/inc. (ANES)"
c.diffs1$dv <- "Culture policy (GSS)"
c.diffs2$dv <- "Culture policy (ANES)"
r.diffs1$dv <- "Race policy (GSS)"
r.diffs2$dv <- "Race policy (ANES)"

# Combine results.
pdiffs.all <- bind_rows(e.diffs1, e.diffs2, 
                       c.diffs1, c.diffs2,
                       r.diffs1, r.diffs2)
# Reorder factors.
pdiffs.all$sample <- factor(pdiffs.all$sample, 
                           levels = c("White", 
                                      "Nonwhite", 
                                      "All"))
pdiffs.all$var <- factor(pdiffs.all$var, 
                        levels = c("white", "edu5", 
                                   "inc5","egp2.5", 
                                   "egp1.5", "subclass"))
pdiffs.all$dv <- factor(pdiffs.all$dv, 
                       levels = c("Reduce inequality (GSS)",
                                  "Guarantee jobs/inc. (ANES)",
                                  "Culture policy (GSS)",
                                  "Culture policy (ANES)",
                                  "Race policy (GSS)",
                                  "Race policy (ANES)"))



# Plots.
figDiffsPol <- ggplot(pdiffs.all, aes(y = factor(var), 
                                      x = diff, 
                                      group = sample)) +
  geom_vline(xintercept = 0, color = "gray", 
             linetype = "dashed") +
  ggplot2::geom_errorbarh(aes(xmin = ll, xmax = ul), 
                          size = 1.0, color = "gray", 
                          height = 0, 
                          position=ggstance::position_dodgev(height=0.5)) +
  geom_point(aes(color = sample, shape = sample), size = 2, 
             position=ggstance::position_dodgev(height=0.5)) +
  facet_wrap( ~ dv, ncol = 2) +
  labs(x = "Change in Support", 
       y = "Social Class Characteristics") +
  fte_theme() +
  theme(legend.text = element_text(size = 10),
        legend.title = element_blank(),
        legend.key = element_rect(color = color.background), 
        legend.position = "bottom",
        strip.text.x = element_text(size = 8),
        legend.spacing.x = unit(0.5, 'cm')) +
  scale_y_discrete(labels = class_labs2) +
  scale_shape_discrete(breaks = c("All", "Nonwhite", "White")) +
  scale_color_discrete(breaks = c("All", "Nonwhite", "White")) +
  theme(plot.background = element_rect(fill = "white"))

tiff(file = "fig3.tif", width=6.5, height=7.0, units="in", res=600)
figDiffsPol
dev.off()


# Over time effects.
# Redistribution.

# Load data.
# Inequality.
ineq.egp <- read_dta("./results/ineq_egp5_time.dta")
ineq.subclass <- read_dta("./results/ineq_subclass_time.dta")
ineq.inc <- read_dta("./results/ineq_inc5_time.dta")
ineq.edu <- read_dta("./results/ineq_edu5_time.dta")

# Jobs and income.
jobs.egp <- read_dta("./results/jobs_egp5_time.dta")
jobs.subclass <- read_dta("./results/jobs_subclass_time.dta")
jobs.inc <- read_dta("./results/jobs_inc5_time.dta")
jobs.edu <- read_dta("./results/jobs_edu5_time.dta")


# Create DV indicator.
ineq.egp$dv <- "Reduce inequality (GSS)"
jobs.egp$dv <- "Guarantee jobs/inc. (ANES)"

# Combine estimates for plotting.
# First need subset of EGP results.
egplst <- list(ineq.egp, jobs.egp)
egplst <- egplst %>%
  map(~ filter(., egp5==1 | egp5==2)) %>%
  map(~ rename(., b = b_egp)) %>%
  map(~ rename(., b_hi = b_egp_hi)) %>%
  map(~ rename(., b_lo = b_egp_lo)) %>%
  map(~ mutate(., var = ifelse(egp5 == 1, "Upper Class", 
                      "Upper Mid. Class")))

# Combine list of data frames.
time.redist <- bind_rows(egplst)

# Create DV indicators and combine other data frames.
ineqlst <- list(ineq.subclass, ineq.inc, ineq.edu)
ineqlst <- ineqlst %>%
  map(~ mutate(., dv = "Reduce inequality (GSS)"))

jobslst <- list(jobs.subclass, jobs.inc, jobs.edu)
jobslst <- jobslst %>%
  map(~ mutate(., dv = "Guarantee jobs/inc. (ANES)"))

time.redist <- bind_rows(time.redist, ineqlst, jobslst)

# Rename variables.
time.redist <- 
  time.redist %>% 
  mutate(var = recode_factor(var, 
                "Upper Class" = "Upper Class",
                "Upper Mid. Class" = "Upper Mid. Class",
                "subclass" = "Subjective Class",
                "inc5" = "Income",
                "edu5" = "Education", .ordered = TRUE))

# Reorder DV.
dv.ord <- c("Reduce inequality (GSS)",
            "Guarantee jobs/inc. (ANES)")
time.redist$dv <- factor(time.redist$dv, 
                         levels = dv.ord)

# Save combined data.
#write_dta(time.redist, "time_redist.dta")
saveRDS(time.redist, "./results/time_redist.rds")


# Plots.

figTimeRedist <- ggplot(time.redist, aes(y = b, x = year)) +
  geom_hline(yintercept = 0, color = "gray", linetype = "dashed") +
  geom_errorbar(aes(ymin = b_lo, ymax = b_hi), 
                size = 1, color = "gray", width=0) +
  geom_point(color = "#619cff", size = 2) +
  facet_grid(var ~ dv, scales = "free_y") +
  labs(x = "Year", 
       y = "Estimated Coefficients") +
  fte_theme() +
  theme(legend.position = "none") +
  scale_x_continuous(breaks = seq(1972, 2018, 8)) +
  theme(plot.background = element_rect(fill = "white"))

tiff(file = "fig4.tif", width=6, height=6, units="in", res=600)
figTimeRedist
dev.off()


# Over time effects.
# Culture.

# Load data.
# GSS.
cultgss.egp <- read_dta("./results/cultgss_egp5_time.dta")
cultgss.subclass <- read_dta("./results/cultgss_subclass_time.dta")
cultgss.inc <- read_dta("./results/cultgss_inc5_time.dta")
cultgss.edu <- read_dta("./results/cultgss_edu5_time.dta")

# ANES.
cultanes.egp <- read_dta("./results/cultanes_egp5_time.dta")
cultanes.subclass <- read_dta("./results/cultanes_subclass_time.dta")
cultanes.inc <- read_dta("./results/cultanes_inc5_time.dta")
cultanes.edu <- read_dta("./results/cultanes_edu5_time.dta")


# Create DV indicator.
cultgss.egp$dv <- "Culture policy (GSS)"
cultanes.egp$dv <- "Culture policy (ANES)"

# Combine estimates for plotting.
# First need subset of EGP results.
egplst2 <- list(cultgss.egp, cultanes.egp)
egplst2 <- egplst2 %>%
  map(~ filter(., egp5==1 | egp5==2)) %>%
  map(~ rename(., b = b_egp)) %>%
  map(~ rename(., b_hi = b_egp_hi)) %>%
  map(~ rename(., b_lo = b_egp_lo)) %>%
  map(~ mutate(., var = ifelse(egp5 == 1, "Upper Class", 
                               "Upper Mid. Class")))

# Combine list of data frames.
time.cult <- bind_rows(egplst2)

# Create DV indicators and combine other data frames.
cultgsslst <- list(cultgss.subclass, cultgss.inc, cultgss.edu)
cultgsslst <- cultgsslst %>%
  map(~ mutate(., dv = "Culture policy (GSS)"))

cultaneslst <- list(cultanes.subclass, cultanes.inc, cultanes.edu)
cultaneslst <- cultaneslst %>%
  map(~ mutate(., dv = "Culture policy (ANES)"))

time.cult <- bind_rows(time.cult, cultgsslst, cultaneslst)

# Rename variables.
time.cult <- 
  time.cult %>% 
  mutate(var = recode_factor(var, 
                             "Upper Class" = "Upper Class",
                             "Upper Mid. Class" = "Upper Mid. Class",
                             "subclass" = "Subjective Class",
                             "inc5" = "Income",
                             "edu5" = "Education", .ordered = TRUE))

# Reorder DV.
dv.ord <- c("Culture policy (GSS)",
            "Culture policy (ANES)")
time.cult$dv <- factor(time.cult$dv, 
                         levels = dv.ord)

# Save combined data.
#write_dta(time.cult, "time_cult.dta")
saveRDS(time.cult, file = "./results/time_cult.rds")


# Plots.

figTimeCult <- ggplot(time.cult, aes(y = b, x = year)) +
  geom_hline(yintercept = 0, color = "gray", linetype = "dashed") +
  geom_errorbar(aes(ymin = b_lo, ymax = b_hi), 
                size = 1, color = "gray", width=0) +
  geom_point(color = "coral", size = 2) +
  facet_grid(var ~ dv, scales = "free_y") +
  labs(x = "Year", 
       y = "Estimated Coefficients") +
  fte_theme() +
  theme(legend.position = "none") +
  scale_x_continuous(breaks = seq(1972, 2018, 8)) +
  theme(plot.background = element_rect(fill = "white"))

tiff(file = "fig5.tif", width=6, height=6, units="in", res=600)
figTimeCult
dev.off()


# Over time effects.
# Race.

# Load data.
# GSS.
racegss.egp <- read_dta("./results/racegss_egp5_time_wo.dta")
racegss.subclass <- read_dta("./results/racegss_subclass_time_wo.dta")
racegss.inc <- read_dta("./results/racegss_inc5_time_wo.dta")
racegss.edu <- read_dta("./results/racegss_edu5_time_wo.dta")

# ANES.
raceanes.egp <- read_dta("./results/raceanes_egp5_time_wo.dta")
raceanes.subclass <- read_dta("./results/raceanes_subclass_time_wo.dta")
raceanes.inc <- read_dta("./results/raceanes_inc5_time_wo.dta")
raceanes.edu <- read_dta("./results/raceanes_edu5_time_wo.dta")


# Create DV indicator.
racegss.egp$dv <- "Race policy (GSS)"
raceanes.egp$dv <- "Race policy (ANES)"

# Combine estimates for plotting.
# First need subset of EGP results.
egplst3 <- list(racegss.egp, raceanes.egp)
egplst3 <- egplst3 %>%
  map(~ filter(., egp5==1 | egp5==2)) %>%
  map(~ rename(., b = b_egp)) %>%
  map(~ rename(., b_hi = b_egp_hi)) %>%
  map(~ rename(., b_lo = b_egp_lo)) %>%
  map(~ mutate(., var = ifelse(egp5 == 1, "Upper Class", 
                               "Upper Mid. Class")))

# Combine list of data frames.
time.race <- bind_rows(egplst3)

# Create DV indicators and combine other data frames.
racegsslst <- list(racegss.subclass, racegss.inc, racegss.edu)
racegsslst <- racegsslst %>%
  map(~ mutate(., dv = "Race policy (GSS)"))

raceaneslst <- list(raceanes.subclass, raceanes.inc, raceanes.edu)
raceaneslst <- raceaneslst %>%
  map(~ mutate(., dv = "Race policy (ANES)"))

time.race <- bind_rows(time.race, racegsslst, raceaneslst)

# Rename variables.
time.race <- 
  time.race %>% 
  mutate(var = recode_factor(var, 
                             "Upper Class" = "Upper Class",
                             "Upper Mid. Class" = "Upper Mid. Class",
                             "subclass" = "Subjective Class",
                             "inc5" = "Income",
                             "edu5" = "Education", .ordered = TRUE))

# Reorder DV.
dv.ord <- c("Race policy (GSS)",
            "Race policy (ANES)")
time.race$dv <- factor(time.race$dv, 
                       levels = dv.ord)

# Save combined data.
#write_dta(time.race, "time_race.dta")
saveRDS(time.race, file = "./results/time_race.rds")


# Plots.

figTimeRace <- ggplot(time.race, aes(y = b, x = year)) +
  geom_hline(yintercept = 0, color = "gray", linetype = "dashed") +
  geom_errorbar(aes(ymin = b_lo, ymax = b_hi), 
                size = 1, color = "gray", width=0) +
  geom_point(color = "plum", size = 2) +
  facet_grid(var ~ dv, scales = "free_y") +
  labs(x = "Year", 
       y = "Estimated Coefficients") +
  fte_theme() +
  theme(legend.position = "none") +
  scale_x_continuous(breaks = seq(1972, 2018, 8)) +
  theme(plot.background = element_rect(fill = "white"))

tiff(file = "fig6.tif", width=6, height=6, units="in", res=600)
figTimeRace
dev.off()


##################################################
# Policy and voting.
##################################################

# Over time effects.

# Load data.

dvptime.gss <- read_dta("./results/dvote_policy_gss_time.dta")
dvptime.anes <- read_dta("./results/dvote_policy_anes_time.dta")

# Create DV indicator.
dvptime.gss$dv <- "Vote Dem. (GSS)"
dvptime.anes$dv <- "Vote Dem. (ANES)"

# Combine results.
dvptime.all <- bind_rows(dvptime.gss, dvptime.anes)

# New label var.
dvptime.all <- 
  dvptime.all %>% 
  mutate(var2 = recode_factor(var, 
                              "govineq01"="Redist. pol.",
                              "jobs01"="Redist. pol.",
                              "culpol01"="Culture pol.",
                              "racepol01"="Race pol.", 
                              .ordered = TRUE))

# Reorder factors.
dvptime.all$var2 <- factor(dvptime.all$var2, 
                       levels = c("Redist. pol.", 
                                      "Culture pol.",
                                      "Race pol."))
dvptime.all$dv <- factor(dvptime.all$dv, 
                     levels = c("Vote Dem. (GSS)",
                                "Vote Dem. (ANES)"))


# Save combined data.
#write_dta(dvptime.all, "time_vpol.dta")
saveRDS(dvptime.all, file = "./results/time_vpol.rds")


# Plots.

figTimeDVP <- ggplot(dvptime.all, aes(y = b, x = year)) +
  geom_hline(yintercept = 0, color = "gray", linetype = "dashed") +
  geom_errorbar(aes(ymin = b_lo, ymax = b_hi), 
                size = 1, color = "gray", width=0) +
  geom_point(color = "palegreen3", size = 2) +
  facet_grid(var2 ~ dv, scales = "free_y") +
  labs(x = "Year", 
       y = "Estimated Coefficients") +
  fte_theme() +
  theme(legend.position = "none") +
  scale_x_continuous(breaks = seq(1972, 2018, 8)) +
  theme(plot.background = element_rect(fill = "white"))

tiff(file = "fig7.tif", width=6, height=6, units="in", res=600)
figTimeDVP
dev.off()


##################################################
# Policy, voting, and issue salience.
##################################################

# Marginal effects.

# Load data.

dvpsal.jobs <- read_dta("./results/vote_salient_jobs.dta")
dvpsal.cult <- read_dta("./results/vote_salient_cult.dta")

# Clean variable names.

dvpsal.jobs <- 
  dvpsal.jobs %>% 
  clean_names() 

dvpsal.cult <- 
  dvpsal.cult %>% 
  clean_names() 

# Labels.
dvpsal.jobs$var <- "Guarantee\njobs/inc."
dvpsal.cult$var <- "Culture\npolicy"

# Combine.
dvpsal.all <- bind_rows(dvpsal.jobs, dvpsal.cult)

# Labels.
dvpsal.all <- 
  dvpsal.all %>% 
  mutate(var2 = recode_factor(at, 
                              "1"="No mention of issue",
                              "2"="Mentions issue", 
                              .ordered = TRUE))

# Reorder factors.
dvpsal.all$var <- factor(dvpsal.all$var, 
                           levels = c("Guarantee\njobs/inc.", 
                                      "Culture\npolicy"))



# Plots.

figDVPSal <- ggplot(dvpsal.all, aes(y = margin, x = var,
                                    color = var2, 
                                    shape = var2)) +
  geom_hline(yintercept = 0, color = "gray", 
            linetype = "dashed") +
  geom_errorbar(aes(ymin = ci_lb, ymax = ci_ub), 
                size = 1, color = "gray", width=0,
                position = position_dodge(width = 0.3)) +
  geom_point(size = 3, 
             position = position_dodge(width = 0.3)) +
  labs(x = "", 
       y = "Marginal Effect on Dem. Vote") +
  fte_theme() +
  theme(legend.text = element_text(size = 10),
        legend.title = element_blank(),
        legend.key = element_rect(color = color.background), 
        legend.background = element_rect(fill = color.background),
        legend.position = "bottom",
        strip.text.x = element_text(size = 8),
        legend.spacing.x = unit(0.5, 'cm')) +
  scale_color_manual(values=c("#E69F00", "#56B4E9"))

tiff(file = "fig8.tif", width=6, height=5, units="in", res=600)
figDVPSal
dev.off()


